﻿using QFramework;
using UnityEngine;

namespace SnakeGame
{
    public class InitGameCommand : AbstractCommand
    {
        private readonly int mapW, mapH;

        public InitGameCommand(int w, int h)
        {
            mapW = w;
            mapH = h;
        }
        protected override void OnExecute()
        {            
            this.GetSystem<IGridMapSystem>().InitGrid(mapW, mapH);            
            this.GetSystem<ISnakeSystem>().Create(mapW /2 , mapH / 2);            
            this.SendEvent<InitGameEvent>();
        }
    }
}